import Vue from 'vue';
import store from 'store';
import sessStorage from 'store/storages/sessionStorage';

const session = store.createStore(sessStorage);
const PREFIX = 'lj-lvtong-h5';

const storage = {
  get: (key) => {
    return session.get(`${PREFIX}/${key}`);
  },
  set: (key, ...args) => {
    return session.set(`${PREFIX}/${key}`, ...args);
  },
  remove: (key) => {
    return session.remove(`${PREFIX}/${key}`);
  },
  clearAll: () => session.clearAll(),
  install: (v) => {
    v.prototype.$session = storage;
  },
};

Vue.use(storage);

export default storage;
